<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>注册</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <link rel="stylesheet" href="../../css/bootstrap/bootstrap.min.css">
    <link rel="stylesheet" href="../../css/fontawesome/font-awesome.min.css">
    <link rel="stylesheet" href="../../css/ionicon/ionicon.min.css">
    <link rel="stylesheet" href="../../css/adminlet/AdminLTE.min.css">
    <link rel="stylesheet" href="../../plugin/icheck/square/blue.css">
    <link rel="stylesheet"
          href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">
</head>

<body class="hold-transition register-page">
<div class="register-box">
    <div class="register-logo">
        <a href="#"><b>ie</b>Funds</a>
    </div>

    <div class="register-box-body">
        <p class="login-box-msg">Register a new membership</p>

        <form id="registerForm">
            <div class="form-group has-feedback">
                <input type="text" class="form-control" placeholder="Username" name="username">
                <span class="glyphicon glyphicon-user form-control-feedback"></span>
            </div>
            <!--<div class="form-group has-feedback">-->
            <!--<input type="email" class="form-control" placeholder="Email">-->
            <!--<span class="glyphicon glyphicon-envelope form-control-feedback"></span>-->
            <!--</div>-->
            <div class="form-group has-feedback">
                <input type="password" class="form-control" placeholder="Password" name="password">
                <span class="glyphicon glyphicon-lock form-control-feedback"></span>
            </div>
            <div class="form-group has-feedback">
                <input type="password" class="form-control" placeholder="Retype password" name="retypePassword">
                <span class="glyphicon glyphicon-log-in form-control-feedback"></span>
            </div>
            <div class="row">
                <div class="col-xs-8">
                    <div class="checkbox icheck">
                        <label>
                            <input type="checkbox">&nbsp;&nbsp;I agree to the <a href="#">terms</a>
                        </label>
                    </div>
                </div>
                <!-- /.col -->
                <div class="col-xs-4">
                    <button class="btn btn-primary btn-block btn-flat" id="registerBtn">Register</button>
                </div>
                <!-- /.col -->
            </div>
        </form>

        <!--<div class="social-auth-links text-center">-->
        <!--<p>- OR -</p>-->
        <!--<a href="#" class="btn btn-block btn-social btn-facebook btn-flat"><i class="fa fa-facebook"></i> Sign up using-->
        <!--Facebook</a>-->
        <!--<a href="#" class="btn btn-block btn-social btn-google btn-flat"><i class="fa fa-google-plus"></i> Sign up using-->
        <!--Google+</a>-->
        <!--</div>-->

        <a href="/login" class="text-center">I already have a membership</a>
    </div>
    <!-- /.form-box -->
</div>
<!-- /.register-box -->

<!--<script type=”text/javascript” src="../../js/jquery/jquery-3.2.1.min.js"></script>-->
<script src="../../js/jquery/jquery-3.2.1.min.js"></script>
<script src="../../js/bootstrap/bootstrap.min.js"></script>
<script src="../../plugin/icheck/icheck.min.js"></script>

<script>
    $(function () {
        $('input').iCheck({
            checkboxClass: 'icheckbox_square-blue',
            radioClass: 'iradio_square-blue',
            increaseArea: '20%' // optional
        });
    });

    var registerBtn = $("#registerBtn");
    var registerForm = $("#registerForm");
    registerBtn.click(function () {
        $.ajax({
            type: 'post',
            url: '/register',
            data: registerForm.serialize(),
            success: function (response) {
                if (response.resultCode == 200) {
                    window.location.href = "/login";
                }
                else {
                    alert(response.resultCode + ':' + response.resultMessage);
                }
            },
            error: function (response) {
                alert(response);
            }
        });
        return false;
    })
</script>
</body>
</html>
